package com.woniuxy.enjoylife.interceptors;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;


@Configuration
public class InterceptConfiguration implements WebMvcConfigurer{
    @Resource
    private AuthInterceptor authInterceptor;
    @Resource
    private LogInterceptor logInterceptor;

    //配置拦截器拦截的请求类型，拦截所有请求
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor).addPathPatterns("/**");
        registry.addInterceptor(logInterceptor).addPathPatterns("/**");
    }
}
